﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace _42_Kicks
{
    public enum Coups
    {
        Rien,
        Kick,
        Punch,
        //Les coups pour les combos
        Punch1, Punch2, KickCombo1, KickCombo2
    }

    public class Heros : AniSprite
    {
        //Tous les booléens et les timers nécessaires aux cheatcodes
        #region cheat
        public bool GodMode = false;
        public int cheattimer = 0;
        public bool DmG = false;
        public bool cliclimaplaquetournante = false;
        public bool Zehefmonosourcil = false;
        public bool rpzTayTay = false;
        public bool RegardZehef = false;
        public bool CortexLesPyramides = false;
        #endregion

        float TIMERKO = 700f;
        public Coups coup;

        //Pour la projection

        public int projectiontimer = 450;
        public bool projeté = false;
        public int chutetimer = 1050;
        public bool sereleve = false;


        KeyboardState Last; //Cet état de clavier servira à éviter le spammage kikoolol des coups en laissant le doigt appuyé sur le bouton de coup
        //En effet, il détermine l'état précédent du clavier 

        //Ce rect servira à dessiner le personnage en saut 
        public Vector2 jump;
        public Rectangle jump2;
        public Rectangle position2;

        int t1 = 0;
        public int t2 = 0;
        bool Combo = false;
        int combo = 0;
        //Pour les collisions
        public int decalageX;
        public int decalageY;
        //decalageX2 et decalageY2 servent à definir la hitbox lors des sauts
        public int decalageX2;
        public int decalageY2;
        public int largeur2;
        public int hauteur2;


        public int largeur;
        public int hauteur;

        public int PVMAX = 500;
        public int pointdevie = 500;
        //Ces booléens servirons non pas à déclencher les fonctions de marche, saut... mais des effets lors de collisions, des coups ce genre de choses
        public bool marche;
        public bool saute;
        public bool pirouette;
        public bool deplat = true;

        //les booléens pour les coups

        public bool Particule = false;
        public bool KO = false;
        public bool COLLISION = false;
        public bool Frappedroite = false;
        public bool Frappegauche = false;
        public bool estfrappedroite = false;
        public bool estfrappegauche = false;
        public int timerestfrappe = 300;


        //Constructeurs de la classe Heros ne rien modifier ici
        public Heros(Vector2 position, Rectangle source)
            : base(position, source)
        { }
        public Heros(float posx, float posy, int x, int y, int width, int height)
            : base(posx, posy, x, y, width, height)
        { }
        public Heros(Texture2D texture)
            : base(texture)
        { }

        public override void LoadContent(ContentManager content, string assetName)
        {
            texture = content.Load<Texture2D>(assetName);
            jump = position;
        }

        //Cette putain de méthode sert à définir la hitbox t'entends ??? Vu qu'on peut monter descendre la rue 
        //la hitbox du perso est un mini rect à raz du sol
        public virtual void SetRect()
        {

            if (marche && !saute && !pirouette)
            { decalageX = 51; largeur = 52; decalageY = 125; hauteur = 42; }
            if (!marche && !saute && !pirouette)
            { decalageX = 42; largeur = 57; decalageY = 125; hauteur = 42; }
            if (!marche && !saute && !pirouette)
            { decalageX = 51; largeur = 57; decalageY = 125; hauteur = 42; }
            if (!marche && saute && !pirouette)
            { decalageX = 51; largeur = 57; decalageY = 125; hauteur = 42; }
            if (!marche && saute && pirouette)
            { decalageX = 30; largeur = 98; decalageY = 125; hauteur = 42; }


            //On définit la hitbox lors des coups
            if (!saute && coup == Coups.Kick && source.Y == 604)
            { decalageX = 35; largeur = 85; decalageY = 125; hauteur = 42; }
            if (!saute && coup == Coups.Kick && source.Y == 755)
            { decalageX = 15; largeur = 85; decalageY = 125; hauteur = 42; }
            if (!saute && coup == Coups.Punch && source.Y == 604)
            { decalageX = 48; largeur = 65; decalageY = 125; hauteur = 42; }
            if (!saute && coup == Coups.Punch && source.Y == 755)
            { decalageX = 30; largeur = 65; decalageY = 125; hauteur = 42; }

            //Ici on définit les décalages du rectangle jump2
            if (saute && !pirouette)
            { decalageX2 = 42; largeur2 = 76; decalageY2 = 18; hauteur2 = 133; }
            if (saute && pirouette)
            { decalageX2 = 20; largeur2 = 110; decalageY2 = 20; hauteur2 = 110; }


            //Définit le Rectangle position2 (ce rectangle sert à représenter la hitbox du personnage quand il ne saute pas)
            position2 = new Rectangle(((int)position.X + decalageX), ((int)position.Y + decalageY), largeur, hauteur);
            //Définit le rectangle jump2 (ce vecteur sert à représenter la hitbox du personnage en saut)
            jump2 = new Rectangle(((int)jump.X + decalageX2), ((int)jump.Y + decalageY2), largeur2, hauteur2);

        }



        /*Méthode de collision, on s'en servira simplement pour déterminer s'il y a collision, mais en aucun cas elle ne génère d'effets autres que la détection */
        public virtual bool Collision(Rectangle colli)
        {

            if (position2.Intersects(colli))
            {
                COLLISION = true;
                return true;
            }
            else
            {
                COLLISION = false;
                return false;
            }

        }


        public void Projection(GameTime gameTime, Boss boss)
        {
            if (!KO)
            {
                if (projeté)
                {
                    projectiontimer -= gameTime.ElapsedGameTime.Milliseconds;
                    chutetimer -= gameTime.ElapsedGameTime.Milliseconds;
                }
                if (projeté && projectiontimer > 0 && !sereleve)
                {
                    if (position.X >= boss.position.X && projectiontimer >= 0)
                    {
                        position.X += 3;

                        DefileSpriteGauche(0, 1661, 1359, 100, 151, gameTime);

                    }
                    if (position.X < boss.position.X)
                    {
                        position.X -= 3;

                        DefileSprite(0, 1661, 1208, 100, 151, gameTime);
                    }

                }
                if (projeté && chutetimer > 0 && projectiontimer <= 0)
                {
                    sereleve = true;
                }
                if (projeté && chutetimer > 0)
                {

                    if (position.X >= boss.position.X && projectiontimer >= 0)
                    {

                        DefileSpriteGauche(0, 1661, 1359, 100, 151, gameTime);

                    }
                    if (position.X < boss.position.X)
                    {

                        DefileSprite(0, 1661, 1208, 100, 151, gameTime);
                    }
                }
                if (projectiontimer <= 0)
                {

                    projectiontimer = 450;

                }
                if (chutetimer <= 0)
                {
                    projeté = false;
                    chutetimer = 1050;
                    sereleve = false;
                }
            }
        }

        // Ceci est la méthode de marche, à déclencher pour permettre au personnage de marcher

        public virtual void Marche(GameTime gameTime)
        {
            if (coup == Coups.Rien)
            {
                KeyboardState KState = Keyboard.GetState();
                if (KState.IsKeyDown(Keys.Right) || KState.IsKeyDown(Keys.Left) || KState.IsKeyDown(Keys.Up) || KState.IsKeyDown(Keys.Down))
                { marche = true; }
                else { marche = false; }

                //Animations de la marche à gauche
                if (KState.IsKeyDown(Keys.Left) && marche == true && saute == false)
                {
                    position += (new Vector2(-1 * gameTime.ElapsedGameTime.Milliseconds * 0.25f, 0));
                    DefileSpriteGauche(1208, 1680, 151, 151, 151, gameTime);
                }//Animations du saut à gauche ????? (je ne comprends plus trop ce que j'ai fait mais ça fonctionne )
                if (KState.IsKeyDown(Keys.Left) && marche == true && saute == true)
                {

                    position += (new Vector2(-1 * gameTime.ElapsedGameTime.Milliseconds * 0.33f, 0));

                }

                //Animations de la marche à droite  
                if (KState.IsKeyDown(Keys.Right) && marche == true && saute == false)
                {
                    position += (new Vector2(1 * gameTime.ElapsedGameTime.Milliseconds * 0.25f, 0));
                    DefileSprite(0, 604, 0, 151, 151, gameTime);

                }//Animations du saut à droite ????? (je ne comprends plus trop ce que j'ai fait mais ça fonctionne )
                if (KState.IsKeyDown(Keys.Right) && marche == true && saute == true)
                {
                    position += (new Vector2(1 * gameTime.ElapsedGameTime.Milliseconds * 0.33f, 0));

                }
                //Déplacement en hauteur
                if (KState.IsKeyDown(Keys.Up) && marche == true && saute == false)
                {


                    position += (new Vector2(0, -1 * gameTime.ElapsedGameTime.Milliseconds * 0.16f));
                    if (source.Y == 0)
                        DefileSprite(0, 604, 0, 151, 151, gameTime);
                    if (source.Y == 151)
                        DefileSpriteGauche(1208, 1680, 151, 151, 151, gameTime);
                }//Déplacement vers le bas
                if (KState.IsKeyDown(Keys.Down) && marche == true && saute == false)
                {


                    position += (new Vector2(0, 1 * gameTime.ElapsedGameTime.Milliseconds * 0.16f));
                    if (source.Y == 0)
                        DefileSprite(0, 604, 0, 151, 151, gameTime);
                    if (source.Y == 151)
                        DefileSpriteGauche(1208, 1680, 151, 151, 151, gameTime);
                }
            }
        }




        //Cette méthode définit l'état d'arrêt et permet entre autres d'avoir des animations cohérentes

        public virtual void Arret(GameTime gameTime)
        {
            KeyboardState KState = Keyboard.GetState();

            if (marche == false && saute == false && coup == Coups.Rien && !estfrappegauche && !estfrappedroite && !projeté)
            {
                if (KState.IsKeyUp(Keys.Down) && source.Y == 0 || source.Y == 302 || source.Y == 604 || source.Y == 906 || source.Y == 1510 || source.Y == 1208)
                {
                    source.X = 604;
                    source.Y = 0;
                }
                if (KState.IsKeyUp(Keys.Down) && source.Y == 151 || source.Y == 453 || source.Y == 755 || source.Y == 1057 || source.Y == 1661 || source.Y == 1359)
                {
                    source.X = 1057;
                    source.Y = 151;
                }
            }
        }


        public virtual void Frappe(GameTime gameTime)
        {

            KeyboardState KState = Keyboard.GetState();

            //POUR LE COUP DE PIED
            if (KState.IsKeyDown(Keys.A) && t2 <= 0 && coup == Coups.Rien && !Last.IsKeyDown(Keys.A))
            {

                coup = Coups.Kick;
                t2 = 357;

            }

            if (coup == Coups.Kick && source.Y == 0 || coup == Coups.Kick && source.Y == 302 || coup == Coups.Kick && source.Y == 604)
            {
                Frappedroite = true;
                Frappegauche = false;
                if (coup == Coups.Kick && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSprite(0, 453, 604, 122, 151, gameTime);
                }
            }
            if (coup == Coups.Kick && source.Y == 151 || coup == Coups.Kick && source.Y == 453 || coup == Coups.Kick && source.Y == 755)
            {
                Frappegauche = true;
                Frappedroite = false;
                if (coup == Coups.Kick && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSpriteGauche(1208, 1645, 755, 122, 151, gameTime);
                }

            }

            //POUR LE COUP DE POING

            if (KState.IsKeyDown(Keys.Z) && t2 <= 0 && coup == Coups.Rien && !Last.IsKeyDown(Keys.Z))
            {

                coup = Coups.Punch;

                t2 = 300;
            }
            if (coup == Coups.Punch && source.Y == 0 || coup == Coups.Punch && source.Y == 302 || coup == Coups.Punch && source.Y == 604)
            {
                Frappedroite = true;
                Frappegauche = false;
                if (coup == Coups.Punch && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSprite(604, 1058, 604, 122, 151, gameTime);
                }
            }
            if (coup == Coups.Punch && source.Y == 151 || coup == Coups.Punch && source.Y == 453 || coup == Coups.Punch && source.Y == 755)
            {
                Frappegauche = true;
                Frappedroite = false;
                if (coup == Coups.Punch && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSpriteGauche(755, 1041, 755, 121, 151, gameTime);
                }

            }

            if (combo > 0)
            { Combo = true; }
            if (combo <= 0)
            { Combo = false; }
            if (Combo == true)
            { combo -= gameTime.ElapsedGameTime.Milliseconds; }
            //Pour le combo 1

            #region Punch1
            if (KState.IsKeyDown(Keys.E) && t2 <= 0 && coup == Coups.Rien && !Last.IsKeyDown(Keys.E))
            {

                coup = Coups.Punch1;
                t2 = 150;
                combo = 400;
            }
            if (coup == Coups.Punch1 && source.Y == 0 || coup == Coups.Punch1 && source.Y == 302 || coup == Coups.Punch1 && source.Y == 604 || coup == Coups.Punch1 && source.Y == 906)
            {
                Frappedroite = true;
                Frappegauche = false;
                if (coup == Coups.Punch1 && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSprite(0, 302, 906, 110, 151, gameTime);
                }
            }
            if (coup == Coups.Punch1 && source.Y == 151 || coup == Coups.Punch1 && source.Y == 453 || coup == Coups.Punch1 && source.Y == 755 || coup == Coups.Punch1 && source.Y == 1057)
            {
                Frappegauche = true;
                Frappedroite = false;
                if (coup == Coups.Punch1 && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSpriteGauche(1510, 1812, 1057, 110, 151, gameTime);
                }

            }
            #endregion
            #region Punch2
            if (KState.IsKeyDown(Keys.E) && t2 <= 0 && coup == Coups.Punch1 && !Last.IsKeyDown(Keys.E) && Combo)
            {

                coup = Coups.Punch2;
                t2 = 200;
                combo = 400;
            }
            if (coup == Coups.Punch2 && source.Y == 0 || coup == Coups.Punch2 && source.Y == 302 || coup == Coups.Punch2 && source.Y == 604 || coup == Coups.Punch2 && source.Y == 906)
            {
                Frappedroite = true;
                Frappegauche = false;
                if (coup == Coups.Punch2 && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSprite(302, 755, 906, 110, 151, gameTime);
                }
            }
            if (coup == Coups.Punch2 && source.Y == 151 || coup == Coups.Punch2 && source.Y == 453 || coup == Coups.Punch2 && source.Y == 755 || coup == Coups.Punch2 && source.Y == 1057)
            {
                Frappegauche = true;
                Frappedroite = false;
                if (coup == Coups.Punch2 && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSpriteGauche(1208, 1645, 1057, 110, 151, gameTime);
                }

            }
            #endregion
            #region KickCombo1
            if (KState.IsKeyDown(Keys.R) && t2 <= 0 && coup == Coups.Punch2 && !Last.IsKeyDown(Keys.E) && Combo)
            {

                coup = Coups.KickCombo1;
                t2 = 220;
                combo = 400;
            }
            if (coup == Coups.KickCombo1 && source.Y == 0 || coup == Coups.KickCombo1 && source.Y == 302 || coup == Coups.KickCombo1 && source.Y == 604 || coup == Coups.KickCombo1 && source.Y == 906)
            {
                Frappedroite = true;
                Frappegauche = false;
                if (coup == Coups.KickCombo1 && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSprite(755, 1510, 906, 110, 151, gameTime);
                }
            }
            if (coup == Coups.KickCombo1 && source.Y == 151 || coup == Coups.KickCombo1 && source.Y == 453 || coup == Coups.KickCombo1 && source.Y == 755 || coup == Coups.KickCombo1 && source.Y == 1057)
            {
                Frappegauche = true;
                Frappedroite = false;
                if (coup == Coups.KickCombo1 && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSpriteGauche(604, 1057, 1057, 110, 151, gameTime);
                }

            }
            #endregion
            #region KickCombo2
            if (KState.IsKeyDown(Keys.R) && t2 <= 0 && coup == Coups.KickCombo1 && !Last.IsKeyDown(Keys.R) && Combo)
            {

                coup = Coups.KickCombo2;
                t2 = 433;
                combo = 800;
            }
            if (coup == Coups.KickCombo2 && source.Y == 0 || coup == Coups.KickCombo2 && source.Y == 302 || coup == Coups.KickCombo2 && source.Y == 604 || coup == Coups.KickCombo2 && source.Y == 906)
            {
                Frappedroite = true;
                Frappegauche = false;
                if (coup == Coups.KickCombo2 && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSprite(1208, 1963, 906, 110, 151, gameTime);
                }
            }
            if (coup == Coups.KickCombo2 && source.Y == 151 || coup == Coups.KickCombo2 && source.Y == 453 || coup == Coups.KickCombo2 && source.Y == 755 || coup == Coups.KickCombo2 && source.Y == 1057)
            {
                Frappegauche = true;
                Frappedroite = false;
                if (coup == Coups.KickCombo2 && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSpriteGauche(0, 604, 1057, 110, 151, gameTime);
                }

            }
            #endregion


            //Pour arreter d'être en état de frappe
            if (t2 <= 0 && Combo == false) { coup = Coups.Rien; Frappedroite = false; Frappegauche = false; }

            Last = KState;
            //Stocke l'état du dernier coup

            //Test combo


        }

        // Ceci est la méthode de saut
        public virtual void Saute(GameTime gameTime)
        {


            KeyboardState KState = Keyboard.GetState();
            jump.X = position.X;
            if (!saute) { jump.Y = position.Y; }
            if (t1 == 0 && KState.IsKeyDown(Keys.Space))
            {
                jump.Y = position.Y;
            }

            if (KState.IsKeyDown(Keys.Space) && t1 <= 0)
            {
                saute = true;
                t1 = 731;
            }

            if (saute == true && t1 > 380)


                jump.Y += -1.8f * gameTime.ElapsedGameTime.Milliseconds * 0.25f;
            t1 -= gameTime.ElapsedGameTime.Milliseconds;
            if (saute == true && t1 < 380)
                jump.Y += 1.8f * gameTime.ElapsedGameTime.Milliseconds * 0.25f;


            //Permet d'avoir l'animation de saut "normale" si on ne se déplace pas au lieu de la pirouette ninja
            if (source.Y == 0 && saute && t1 > 680 || !pirouette && saute && source.Y == 302)
            {


                source.X = 1359;
                source.Y = 0;
            }
            if (source.Y == 151 && saute && t1 > 680 || !pirouette && saute && source.Y == 453)
            {


                source.X = 302;
                source.Y = 151;
            }
            //Permet d'avoir les animations de la pirouette ninja et le booléen pirouette


            if (saute && t1 < 680)
            {

                if (KState.IsKeyDown(Keys.D))
                {
                    pirouette = true;
                    DefileSprite(0, 1208, 302, 94, 151, gameTime);
                }
                if (KState.IsKeyDown(Keys.Q))
                {
                    pirouette = true;
                    DefileSpriteGauche(755, 1661, 453, 94, 151, gameTime);
                }
                if (!KState.IsKeyDown(Keys.D) && !(KState.IsKeyDown(Keys.Q)))
                { pirouette = false; }

            }

            //Permet de retomber


            if (t1 <= 0)

                saute = false;


        }


        public override void Draw(SpriteBatch spriteBatch, Color colour)
        {
            if (saute == false)
                spriteBatch.Draw(texture, position, source, colour);
            else

                spriteBatch.Draw(texture, jump /*Jump c le rectangle pour dessiner le personnage en saut*/, source, colour);
        }


        public void estfrappe(GameTime gameTime)
        {
            if (estfrappedroite)
            {
                timerestfrappe -= gameTime.ElapsedGameTime.Milliseconds;
            }
            if (estfrappegauche)
            {
                timerestfrappe -= gameTime.ElapsedGameTime.Milliseconds;
            }
            if (estfrappedroite && timerestfrappe > 0)
            {
                DefileSprite(0, 755, 1510, 66, 151, gameTime);

            }
            if (estfrappegauche && timerestfrappe > 0)
            {
                DefileSpriteGauche(1057, 1812, 1661, 66, 151, gameTime);

            }
            if (timerestfrappe <= 0)
            {
                timerestfrappe = 300;
                estfrappedroite = false;
                estfrappegauche = false;

            }
            if (pointdevie <= 0)
            {
                KO = true;
                if (TIMERKO >= 0)
                {
                    TIMERKO -= gameTime.ElapsedGameTime.Milliseconds;
                    if (source.Y == 0 || source.Y == 302 || source.Y == 604 || source.Y == 906 || source.Y == 1208)
                        DefileSprite(0, 906, 1208, 110, 151, gameTime);
                    if (source.Y == 151 || source.Y == 453 || source.Y == 755 || source.Y == 1057 || source.Y == 1359)
                        DefileSpriteGauche(1057, 1812, 1359, 110, 151, gameTime);
                }
            }


        }

        public void CheatCode(GameTime gameTime)
        {
            if (cheattimer >= 0)
            {
                cheattimer -= gameTime.ElapsedGameTime.Milliseconds;
            }
            if (cheattimer < 0)
            {
                rpzTayTay = false;
                cliclimaplaquetournante = false;
                Zehefmonosourcil = false;
                RegardZehef = false;
                CortexLesPyramides = false;
            }
            KeyboardState KState = Keyboard.GetState();
            #region GodMode
            if (KState.IsKeyDown(Keys.G) && !Last.IsKeyDown(Keys.G) && !RegardZehef)
            {
                cheattimer = 1500;
                rpzTayTay = true;
            }
            if (KState.IsKeyDown(Keys.O) & cheattimer >= 0 && !Last.IsKeyDown(Keys.G) && rpzTayTay && !cliclimaplaquetournante && !Zehefmonosourcil && !RegardZehef && !CortexLesPyramides)
            {
                cheattimer = 1500;
                cliclimaplaquetournante = true;
            }
            if (KState.IsKeyDown(Keys.D) & cheattimer >= 0 && !Last.IsKeyDown(Keys.O) && cliclimaplaquetournante && rpzTayTay && !Zehefmonosourcil && !RegardZehef && !CortexLesPyramides)
            {
                cheattimer = 1500;
                GodMode = true;
                rpzTayTay = false;
                cliclimaplaquetournante = false;
            }
            #endregion
            #region Cheat Full Hp
            if (KState.IsKeyDown(Keys.F) && !Last.IsKeyDown(Keys.F))
            {
                cheattimer = 1500;
                Zehefmonosourcil = true;
            }
            if (KState.IsKeyDown(Keys.H) & cheattimer >= 0 && !Last.IsKeyDown(Keys.F) && !rpzTayTay && !cliclimaplaquetournante && Zehefmonosourcil && !RegardZehef && !CortexLesPyramides)
            {
                cheattimer = 1500;
                pointdevie = PVMAX;
                Zehefmonosourcil = false;
            }
            #endregion
            #region CheatDégâts
            if (KState.IsKeyDown(Keys.D) && !Last.IsKeyDown(Keys.D))
            {
                cheattimer = 1500;
                RegardZehef = true;
            }
            if (KState.IsKeyDown(Keys.M) & cheattimer >= 0 && !Last.IsKeyDown(Keys.D) && !rpzTayTay && !cliclimaplaquetournante && !Zehefmonosourcil && RegardZehef && !CortexLesPyramides)
            {
                cheattimer = 1500;
                CortexLesPyramides = true;
            }
            if (KState.IsKeyDown(Keys.G) & cheattimer >= 0 && !Last.IsKeyDown(Keys.M) && !rpzTayTay && !cliclimaplaquetournante && !Zehefmonosourcil && RegardZehef && CortexLesPyramides)
            {
                cheattimer = 1500;
                DmG = true;
                RegardZehef = false;
                CortexLesPyramides = false;

            }
            #endregion

            //GOD, FH, DMG
            Last = KState;
        }


    }

}






public class player1 : _42_Kicks.Heros
{


    KeyboardState Last; //Cet état de clavier servira à éviter le spammage kikoolol des coups en laissant le doigt appuyé sur le bouton de coup
    //En effet, il détermine l'état précédent du clavier 

    int t1 = 0;

    bool Combo = false;
    int combo = 0;

    public player1(Vector2 position, Rectangle source)
        : base(position, source)
    { }
    public player1(float posx, float posy, int x, int y, int width, int height)
        : base(posx, posy, x, y, width, height)
    { }
    public player1(Texture2D texture)
        : base(texture)
    { }

    public override void LoadContent(ContentManager content, string assetName)
    {
        texture = content.Load<Texture2D>(assetName);
        jump = position;
    }

    #region marche
    // Ceci est la méthode de marche, à déclencher pour permettre au personnage de marcher

    public override void Marche(GameTime gameTime)
    {
        if (!KO && !projeté)
        {
            if (coup == _42_Kicks.Coups.Rien)
            {
                KeyboardState KState = Keyboard.GetState();
                if (KState.IsKeyDown(Keys.Right) || KState.IsKeyDown(Keys.Left) || KState.IsKeyDown(Keys.Up) || KState.IsKeyDown(Keys.Down))
                { marche = true; }
                else { marche = false; }

                //Animations de la marche à gauche
                if (KState.IsKeyDown(Keys.Left) && marche == true && saute == false)
                {
                    position += (new Vector2(-1 * gameTime.ElapsedGameTime.Milliseconds * 0.25f, 0));
                    DefileSpriteGauche(1208, 1680, 151, 151, 151, gameTime);
                }//Animations du saut à gauche ????? (je ne comprends plus trop ce que j'ai fait mais ça fonctionne )
                if (KState.IsKeyDown(Keys.Left) && marche == true && saute == true)
                {

                    position += (new Vector2(-1 * gameTime.ElapsedGameTime.Milliseconds * 0.33f, 0));

                }

                //Animations de la marche à droite  
                if (KState.IsKeyDown(Keys.Right) && marche == true && saute == false)
                {
                    position += (new Vector2(1 * gameTime.ElapsedGameTime.Milliseconds * 0.25f, 0));
                    DefileSprite(0, 604, 0, 151, 151, gameTime);

                }//Animations du saut à droite ????? (je ne comprends plus trop ce que j'ai fait mais ça fonctionne )
                if (KState.IsKeyDown(Keys.Right) && marche == true && saute == true)
                {
                    position += (new Vector2(1 * gameTime.ElapsedGameTime.Milliseconds * 0.33f, 0));

                }
                //Déplacement en hauteur
                if (KState.IsKeyDown(Keys.Up) && marche == true && saute == false)
                {


                    position += (new Vector2(0, -1 * gameTime.ElapsedGameTime.Milliseconds * 0.16f));
                    if (source.Y == 0)
                        DefileSprite(0, 604, 0, 151, 151, gameTime);
                    if (source.Y == 151)
                        DefileSpriteGauche(1208, 1680, 151, 151, 151, gameTime);
                }//Déplacement vers le bas
                if (KState.IsKeyDown(Keys.Down) && marche == true && saute == false)
                {


                    position += (new Vector2(0, 1 * gameTime.ElapsedGameTime.Milliseconds * 0.16f));
                    if (source.Y == 0)
                        DefileSprite(0, 604, 0, 151, 151, gameTime);
                    if (source.Y == 151)
                        DefileSpriteGauche(1208, 1680, 151, 151, 151, gameTime);
                }
            }
        }
    }
    #endregion marche
    #region frappe
    public override void Frappe(GameTime gameTime)
    {
        if (!KO && !estfrappedroite && !estfrappegauche && !projeté)
        {
            KeyboardState KState = Keyboard.GetState();

            //POUR LE COUP DE PIED
            if (KState.IsKeyDown(Keys.NumPad4) && t2 <= 0 && coup == _42_Kicks.Coups.Rien && !Last.IsKeyDown(Keys.NumPad4))
            {

                coup = _42_Kicks.Coups.Kick;
                t2 = 357;

            }

            if (coup == _42_Kicks.Coups.Kick && source.Y == 0 || coup == _42_Kicks.Coups.Kick && source.Y == 302 || coup == _42_Kicks.Coups.Kick && source.Y == 604)
            {
                Frappedroite = true;
                Frappegauche = false;
                if (coup == _42_Kicks.Coups.Kick && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSprite(0, 453, 604, 122, 151, gameTime);
                }
            }
            if (coup == _42_Kicks.Coups.Kick && source.Y == 151 || coup == _42_Kicks.Coups.Kick && source.Y == 453 || coup == _42_Kicks.Coups.Kick && source.Y == 755)
            {
                Frappegauche = true;
                Frappedroite = false;
                if (coup == _42_Kicks.Coups.Kick && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSpriteGauche(1208, 1645, 755, 122, 151, gameTime);
                }

            }

            //POUR LE COUP DE POING

            if (KState.IsKeyDown(Keys.NumPad6) && t2 <= 0 && coup == _42_Kicks.Coups.Rien && !Last.IsKeyDown(Keys.NumPad6))
            {

                coup = _42_Kicks.Coups.Punch;

                t2 = 300;
            }
            if (coup == _42_Kicks.Coups.Punch && source.Y == 0 || coup == _42_Kicks.Coups.Punch && source.Y == 302 || coup == _42_Kicks.Coups.Punch && source.Y == 604)
            {
                Frappedroite = true;
                Frappegauche = false;
                if (coup == _42_Kicks.Coups.Punch && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSprite(604, 1058, 604, 122, 151, gameTime);
                }
            }
            if (coup == _42_Kicks.Coups.Punch && source.Y == 151 || coup == _42_Kicks.Coups.Punch && source.Y == 453 || coup == _42_Kicks.Coups.Punch && source.Y == 755)
            {
                Frappegauche = true;
                Frappedroite = false;
                if (coup == _42_Kicks.Coups.Punch && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSpriteGauche(755, 1041, 755, 121, 151, gameTime);
                }

            }

            if (combo > 0)
            { Combo = true; }
            if (combo <= 0)
            { Combo = false; }
            if (Combo == true)
            { combo -= gameTime.ElapsedGameTime.Milliseconds; }
            //Pour le combo 1

            #region Punch1
            if (KState.IsKeyDown(Keys.NumPad7) && t2 <= 0 && coup == _42_Kicks.Coups.Rien && !Last.IsKeyDown(Keys.NumPad7))
            {

                coup = _42_Kicks.Coups.Punch1;
                t2 = 150;
                combo = 400;
            }
            if (coup == _42_Kicks.Coups.Punch1 && source.Y == 0 || coup == _42_Kicks.Coups.Punch1 && source.Y == 302 || coup == _42_Kicks.Coups.Punch1 && source.Y == 604 || coup == _42_Kicks.Coups.Punch1 && source.Y == 906)
            {
                Frappedroite = true;
                Frappegauche = false;
                if (coup == _42_Kicks.Coups.Punch1 && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSprite(0, 302, 906, 110, 151, gameTime);
                }
            }
            if (coup == _42_Kicks.Coups.Punch1 && source.Y == 151 || coup == _42_Kicks.Coups.Punch1 && source.Y == 453 || coup == _42_Kicks.Coups.Punch1 && source.Y == 755 || coup == _42_Kicks.Coups.Punch1 && source.Y == 1057)
            {
                Frappegauche = true;
                Frappedroite = false;
                if (coup == _42_Kicks.Coups.Punch1 && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSpriteGauche(1510, 1812, 1057, 110, 151, gameTime);
                }

            }
            #endregion
            #region Punch2
            if (KState.IsKeyDown(Keys.NumPad7) && t2 <= 0 && coup == _42_Kicks.Coups.Punch1 && !Last.IsKeyDown(Keys.NumPad7) && Combo)
            {

                coup = _42_Kicks.Coups.Punch2;
                t2 = 200;
                combo = 400;
            }
            if (coup == _42_Kicks.Coups.Punch2 && source.Y == 0 || coup == _42_Kicks.Coups.Punch2 && source.Y == 302 || coup == _42_Kicks.Coups.Punch2 && source.Y == 604 || coup == _42_Kicks.Coups.Punch2 && source.Y == 906)
            {
                Frappedroite = true;
                Frappegauche = false;
                if (coup == _42_Kicks.Coups.Punch2 && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSprite(302, 755, 906, 110, 151, gameTime);
                }
            }
            if (coup == _42_Kicks.Coups.Punch2 && source.Y == 151 || coup == _42_Kicks.Coups.Punch2 && source.Y == 453 || coup == _42_Kicks.Coups.Punch2 && source.Y == 755 || coup == _42_Kicks.Coups.Punch2 && source.Y == 1057)
            {
                Frappegauche = true;
                Frappedroite = false;
                if (coup == _42_Kicks.Coups.Punch2 && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSpriteGauche(1208, 1645, 1057, 110, 151, gameTime);
                }

            }
            #endregion
            #region KickCombo1
            if (KState.IsKeyDown(Keys.NumPad9) && t2 <= 0 && coup == _42_Kicks.Coups.Punch2 && !Last.IsKeyDown(Keys.NumPad9) && Combo)
            {

                coup = _42_Kicks.Coups.KickCombo1;
                t2 = 220;
                combo = 400;
            }
            if (coup == _42_Kicks.Coups.KickCombo1 && source.Y == 0 || coup == _42_Kicks.Coups.KickCombo1 && source.Y == 302 || coup == _42_Kicks.Coups.KickCombo1 && source.Y == 604 || coup == _42_Kicks.Coups.KickCombo1 && source.Y == 906)
            {
                Frappedroite = true;
                Frappegauche = false;
                if (coup == _42_Kicks.Coups.KickCombo1 && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSprite(755, 1510, 906, 110, 151, gameTime);
                }
            }
            if (coup == _42_Kicks.Coups.KickCombo1 && source.Y == 151 || coup == _42_Kicks.Coups.KickCombo1 && source.Y == 453 || coup == _42_Kicks.Coups.KickCombo1 && source.Y == 755 || coup == _42_Kicks.Coups.KickCombo1 && source.Y == 1057)
            {
                Frappegauche = true;
                Frappedroite = false;
                if (coup == _42_Kicks.Coups.KickCombo1 && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSpriteGauche(604, 1057, 1057, 110, 151, gameTime);
                }

            }
            #endregion
            #region KickCombo2
            if (KState.IsKeyDown(Keys.NumPad9) && t2 <= 0 && coup == _42_Kicks.Coups.KickCombo1 && !Last.IsKeyDown(Keys.NumPad9) && Combo)
            {

                coup = _42_Kicks.Coups.KickCombo2;
                t2 = 433;
                combo = 800;
            }
            if (coup == _42_Kicks.Coups.KickCombo2 && source.Y == 0 || coup == _42_Kicks.Coups.KickCombo2 && source.Y == 302 || coup == _42_Kicks.Coups.KickCombo2 && source.Y == 604 || coup == _42_Kicks.Coups.KickCombo2 && source.Y == 906)
            {
                Frappedroite = true;
                Frappegauche = false;
                if (coup == _42_Kicks.Coups.KickCombo2 && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSprite(1208, 1963, 906, 110, 151, gameTime);
                }
            }
            if (coup == _42_Kicks.Coups.KickCombo2 && source.Y == 151 || coup == _42_Kicks.Coups.KickCombo2 && source.Y == 453 || coup == _42_Kicks.Coups.KickCombo2 && source.Y == 755 || coup == _42_Kicks.Coups.KickCombo2 && source.Y == 1057)
            {
                Frappegauche = true;
                Frappedroite = false;
                if (coup == _42_Kicks.Coups.KickCombo2 && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSpriteGauche(0, 604, 1057, 110, 151, gameTime);
                }

            }
            #endregion


            //Pour arreter d'être en état de frappe
            if (t2 <= 0 && Combo == false) { coup = _42_Kicks.Coups.Rien; Frappedroite = false; Frappegauche = false; }


            Last = KState;
            //Stocke l'état du dernier coup

            //Test combo


        }
    }
    #endregion frappe

    #region saut
    // Ceci est la méthode de saut
    public override void Saute(GameTime gameTime)
    {
        if (!KO && !projeté)
        {

            KeyboardState KState = Keyboard.GetState();
            jump.X = position.X;
            if (!saute) { jump.Y = position.Y; }
            if (t1 == 0 && KState.IsKeyDown(Keys.NumPad8))
            {
                jump.Y = position.Y;
            }

            if (KState.IsKeyDown(Keys.NumPad8) && t1 <= 0)
            {
                saute = true;
                t1 = 731;
            }

            if (saute == true && t1 > 380)


                jump.Y += -1.8f * gameTime.ElapsedGameTime.Milliseconds * 0.25f;
            t1 -= gameTime.ElapsedGameTime.Milliseconds;
            if (saute == true && t1 < 380)
                jump.Y += 1.8f * gameTime.ElapsedGameTime.Milliseconds * 0.25f;


            //Permet d'avoir l'animation de saut "normale" si on ne se déplace pas au lieu de la pirouette ninja
            if (source.Y == 0 && saute && t1 > 680 || !pirouette && saute && source.Y == 302)
            {


                source.X = 1359;
                source.Y = 0;
            }
            if (source.Y == 151 && saute && t1 > 680 || !pirouette && saute && source.Y == 453)
            {


                source.X = 302;
                source.Y = 151;
            }
            //Permet d'avoir les animations de la pirouette ninja et le booléen pirouette


            if (saute && t1 < 680)
            {

                if (KState.IsKeyDown(Keys.Right))
                {
                    pirouette = true;
                    DefileSprite(0, 1208, 302, 94, 151, gameTime);
                }
                if (KState.IsKeyDown(Keys.Left))
                {
                    pirouette = true;
                    DefileSpriteGauche(755, 1661, 453, 94, 151, gameTime);
                }
                if (!KState.IsKeyDown(Keys.Right) && !(KState.IsKeyDown(Keys.Left)))
                { pirouette = false; }

            }

            //Permet de retomber


            if (t1 <= 0)

                saute = false;

        }
    }
    #endregion saut

}

public class player2 : _42_Kicks.Heros
{


    KeyboardState Last; //Cet état de clavier servira à éviter le spammage kikoolol des coups en laissant le doigt appuyé sur le bouton de coup
    //En effet, il détermine l'état précédent du clavier 

    int t1 = 0;

    bool Combo = false;
    int combo = 0;

    public player2(Vector2 position, Rectangle source)
        : base(position, source)
    { }
    public player2(float posx, float posy, int x, int y, int width, int height)
        : base(posx, posy, x, y, width, height)
    { }
    public player2(Texture2D texture)
        : base(texture)
    { }

    public override void LoadContent(ContentManager content, string assetName)
    {
        texture = content.Load<Texture2D>(assetName);
        jump = position;
    }

    #region marche
    // Ceci est la méthode de marche, à déclencher pour permettre au personnage de marcher

    public override void Marche(GameTime gameTime)
    {
        if (!KO && !projeté)
        {
            if (coup == _42_Kicks.Coups.Rien)
            {
                KeyboardState KState = Keyboard.GetState();
                if (KState.IsKeyDown(Keys.Z) || KState.IsKeyDown(Keys.Q) || KState.IsKeyDown(Keys.S) || KState.IsKeyDown(Keys.D))
                { marche = true; }
                else { marche = false; }

                //Animations de la marche à gauche
                if (KState.IsKeyDown(Keys.Q) && marche == true && saute == false)
                {
                    position += (new Vector2(-1 * gameTime.ElapsedGameTime.Milliseconds * 0.25f, 0));
                    DefileSpriteGauche(1208, 1680, 151, 151, 151, gameTime);
                }//Animations du saut à gauche ????? (je ne comprends plus trop ce que j'ai fait mais ça fonctionne )
                if (KState.IsKeyDown(Keys.Q) && marche == true && saute == true)
                {

                    position += (new Vector2(-1 * gameTime.ElapsedGameTime.Milliseconds * 0.33f, 0));

                }

                //Animations de la marche à droite  
                if (KState.IsKeyDown(Keys.D) && marche == true && saute == false)
                {
                    position += (new Vector2(1 * gameTime.ElapsedGameTime.Milliseconds * 0.25f, 0));
                    DefileSprite(0, 604, 0, 151, 151, gameTime);

                }//Animations du saut à droite ????? (je ne comprends plus trop ce que j'ai fait mais ça fonctionne )
                if (KState.IsKeyDown(Keys.D) && marche == true && saute == true)
                {
                    position += (new Vector2(1 * gameTime.ElapsedGameTime.Milliseconds * 0.33f, 0));

                }
                //Déplacement en hauteur
                if (KState.IsKeyDown(Keys.Z) && marche == true && saute == false)
                {


                    position += (new Vector2(0, -1 * gameTime.ElapsedGameTime.Milliseconds * 0.16f));
                    if (source.Y == 0)
                        DefileSprite(0, 604, 0, 151, 151, gameTime);
                    if (source.Y == 151)
                        DefileSpriteGauche(1208, 1680, 151, 151, 151, gameTime);
                }//Déplacement vers le bas
                if (KState.IsKeyDown(Keys.S) && marche == true && saute == false)
                {


                    position += (new Vector2(0, 1 * gameTime.ElapsedGameTime.Milliseconds * 0.16f));
                    if (source.Y == 0)
                        DefileSprite(0, 604, 0, 151, 151, gameTime);
                    if (source.Y == 151)
                        DefileSpriteGauche(1208, 1680, 151, 151, 151, gameTime);
                }
            }
        }
    }
    #endregion marche
    #region frappe
    public override void Frappe(GameTime gameTime)
    {
        if (!KO && !estfrappedroite && !estfrappegauche && !projeté)
        {
            KeyboardState KState = Keyboard.GetState();

            //POUR LE COUP DE PIED
            if (KState.IsKeyDown(Keys.A) && t2 <= 0 && coup == _42_Kicks.Coups.Rien && !Last.IsKeyDown(Keys.A))
            {

                coup = _42_Kicks.Coups.Kick;
                t2 = 357;

            }

            if (coup == _42_Kicks.Coups.Kick && source.Y == 0 || coup == _42_Kicks.Coups.Kick && source.Y == 302 || coup == _42_Kicks.Coups.Kick && source.Y == 604)
            {
                Frappedroite = true;
                Frappegauche = false;
                if (coup == _42_Kicks.Coups.Kick && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSprite(0, 453, 604, 122, 151, gameTime);
                }
            }
            if (coup == _42_Kicks.Coups.Kick && source.Y == 151 || coup == _42_Kicks.Coups.Kick && source.Y == 453 || coup == _42_Kicks.Coups.Kick && source.Y == 755)
            {
                Frappegauche = true;
                Frappedroite = false;
                if (coup == _42_Kicks.Coups.Kick && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSpriteGauche(1208, 1645, 755, 122, 151, gameTime);
                }

            }

            //POUR LE COUP DE POING

            if (KState.IsKeyDown(Keys.E) && t2 <= 0 && coup == _42_Kicks.Coups.Rien && !Last.IsKeyDown(Keys.E))
            {

                coup = _42_Kicks.Coups.Punch;

                t2 = 300;
            }
            if (coup == _42_Kicks.Coups.Punch && source.Y == 0 || coup == _42_Kicks.Coups.Punch && source.Y == 302 || coup == _42_Kicks.Coups.Punch && source.Y == 604)
            {
                Frappedroite = true;
                Frappegauche = false;
                if (coup == _42_Kicks.Coups.Punch && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSprite(604, 1058, 604, 122, 151, gameTime);
                }
            }
            if (coup == _42_Kicks.Coups.Punch && source.Y == 151 || coup == _42_Kicks.Coups.Punch && source.Y == 453 || coup == _42_Kicks.Coups.Punch && source.Y == 755)
            {
                Frappegauche = true;
                Frappedroite = false;
                if (coup == _42_Kicks.Coups.Punch && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSpriteGauche(755, 1041, 755, 121, 151, gameTime);
                }

            }

            if (combo > 0)
            { Combo = true; }
            if (combo <= 0)
            { Combo = false; }
            if (Combo == true)
            { combo -= gameTime.ElapsedGameTime.Milliseconds; }
            //Pour le combo 1

            #region Punch1
            if (KState.IsKeyDown(Keys.C) && t2 <= 0 && coup == _42_Kicks.Coups.Rien && !Last.IsKeyDown(Keys.C))
            {

                coup = _42_Kicks.Coups.Punch1;
                t2 = 150;
                combo = 400;
            }
            if (coup == _42_Kicks.Coups.Punch1 && source.Y == 0 || coup == _42_Kicks.Coups.Punch1 && source.Y == 302 || coup == _42_Kicks.Coups.Punch1 && source.Y == 604 || coup == _42_Kicks.Coups.Punch1 && source.Y == 906)
            {
                Frappedroite = true;
                Frappegauche = false;
                if (coup == _42_Kicks.Coups.Punch1 && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSprite(0, 302, 906, 110, 151, gameTime);
                }
            }
            if (coup == _42_Kicks.Coups.Punch1 && source.Y == 151 || coup == _42_Kicks.Coups.Punch1 && source.Y == 453 || coup == _42_Kicks.Coups.Punch1 && source.Y == 755 || coup == _42_Kicks.Coups.Punch1 && source.Y == 1057)
            {
                Frappegauche = true;
                Frappedroite = false;
                if (coup == _42_Kicks.Coups.Punch1 && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSpriteGauche(1510, 1812, 1057, 110, 151, gameTime);
                }

            }
            #endregion
            #region Punch2
            if (KState.IsKeyDown(Keys.C) && t2 <= 0 && coup == _42_Kicks.Coups.Punch1 && !Last.IsKeyDown(Keys.C) && Combo)
            {

                coup = _42_Kicks.Coups.Punch2;
                t2 = 200;
                combo = 400;
            }
            if (coup == _42_Kicks.Coups.Punch2 && source.Y == 0 || coup == _42_Kicks.Coups.Punch2 && source.Y == 302 || coup == _42_Kicks.Coups.Punch2 && source.Y == 604 || coup == _42_Kicks.Coups.Punch2 && source.Y == 906)
            {
                Frappedroite = true;
                Frappegauche = false;
                if (coup == _42_Kicks.Coups.Punch2 && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSprite(302, 755, 906, 110, 151, gameTime);
                }
            }
            if (coup == _42_Kicks.Coups.Punch2 && source.Y == 151 || coup == _42_Kicks.Coups.Punch2 && source.Y == 453 || coup == _42_Kicks.Coups.Punch2 && source.Y == 755 || coup == _42_Kicks.Coups.Punch2 && source.Y == 1057)
            {
                Frappegauche = true;
                Frappedroite = false;
                if (coup == _42_Kicks.Coups.Punch2 && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSpriteGauche(1208, 1645, 1057, 110, 151, gameTime);
                }

            }
            #endregion
            #region KickCombo1
            if (KState.IsKeyDown(Keys.V) && t2 <= 0 && coup == _42_Kicks.Coups.Punch2 && !Last.IsKeyDown(Keys.V) && Combo)
            {

                coup = _42_Kicks.Coups.KickCombo1;
                t2 = 220;
                combo = 400;
            }
            if (coup == _42_Kicks.Coups.KickCombo1 && source.Y == 0 || coup == _42_Kicks.Coups.KickCombo1 && source.Y == 302 || coup == _42_Kicks.Coups.KickCombo1 && source.Y == 604 || coup == _42_Kicks.Coups.KickCombo1 && source.Y == 906)
            {
                Frappedroite = true;
                Frappegauche = false;
                if (coup == _42_Kicks.Coups.KickCombo1 && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSprite(755, 1510, 906, 110, 151, gameTime);
                }
            }
            if (coup == _42_Kicks.Coups.KickCombo1 && source.Y == 151 || coup == _42_Kicks.Coups.KickCombo1 && source.Y == 453 || coup == _42_Kicks.Coups.KickCombo1 && source.Y == 755 || coup == _42_Kicks.Coups.KickCombo1 && source.Y == 1057)
            {
                Frappegauche = true;
                Frappedroite = false;
                if (coup == _42_Kicks.Coups.KickCombo1 && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSpriteGauche(604, 1057, 1057, 110, 151, gameTime);
                }

            }
            #endregion
            #region KickCombo2
            if (KState.IsKeyDown(Keys.V) && t2 <= 0 && coup == _42_Kicks.Coups.KickCombo1 && !Last.IsKeyDown(Keys.V) && Combo)
            {

                coup = _42_Kicks.Coups.KickCombo2;
                t2 = 433;
                combo = 800;
            }
            if (coup == _42_Kicks.Coups.KickCombo2 && source.Y == 0 || coup == _42_Kicks.Coups.KickCombo2 && source.Y == 302 || coup == _42_Kicks.Coups.KickCombo2 && source.Y == 604 || coup == _42_Kicks.Coups.KickCombo2 && source.Y == 906)
            {
                Frappedroite = true;
                Frappegauche = false;
                if (coup == _42_Kicks.Coups.KickCombo2 && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSprite(1208, 1963, 906, 110, 151, gameTime);
                }
            }
            if (coup == _42_Kicks.Coups.KickCombo2 && source.Y == 151 || coup == _42_Kicks.Coups.KickCombo2 && source.Y == 453 || coup == _42_Kicks.Coups.KickCombo2 && source.Y == 755 || coup == _42_Kicks.Coups.KickCombo2 && source.Y == 1057)
            {
                Frappegauche = true;
                Frappedroite = false;
                if (coup == _42_Kicks.Coups.KickCombo2 && t2 > 0)
                {
                    t2 -= gameTime.ElapsedGameTime.Milliseconds;
                    DefileSpriteGauche(0, 604, 1057, 110, 151, gameTime);
                }

            }
            #endregion



            //Pour arreter d'être en état de frappe
            if (t2 <= 0 && Combo == false) { coup = _42_Kicks.Coups.Rien; Frappedroite = false; Frappegauche = false; }

            Last = KState;
            //Stocke l'état du dernier coup

            //Test combo


        }
    }
    #endregion frappe

    #region saut
    // Ceci est la méthode de saut
    public override void Saute(GameTime gameTime)
    {
        if (!KO && !projeté)
        {

            KeyboardState KState = Keyboard.GetState();
            jump.X = position.X;
            if (!saute) { jump.Y = position.Y; }
            if (t1 == 0 && KState.IsKeyDown(Keys.Space))
            {
                jump.Y = position.Y;
            }

            if (KState.IsKeyDown(Keys.Space) && t1 <= 0)
            {
                saute = true;
                t1 = 731;
            }

            if (saute == true && t1 > 380)


                jump.Y += -1.8f * gameTime.ElapsedGameTime.Milliseconds * 0.25f;
            t1 -= gameTime.ElapsedGameTime.Milliseconds;
            if (saute == true && t1 < 380)
                jump.Y += 1.8f * gameTime.ElapsedGameTime.Milliseconds * 0.25f;


            //Permet d'avoir l'animation de saut "normale" si on ne se déplace pas au lieu de la pirouette ninja
            if (source.Y == 0 && saute && t1 > 680 || !pirouette && saute && source.Y == 302)
            {


                source.X = 1359;
                source.Y = 0;
            }
            if (source.Y == 151 && saute && t1 > 680 || !pirouette && saute && source.Y == 453)
            {


                source.X = 302;
                source.Y = 151;
            }
            //Permet d'avoir les animations de la pirouette ninja et le booléen pirouette


            if (saute && t1 < 680)
            {

                if (KState.IsKeyDown(Keys.D))
                {
                    pirouette = true;
                    DefileSprite(0, 1208, 302, 94, 151, gameTime);
                }
                if (KState.IsKeyDown(Keys.Q))
                {
                    pirouette = true;
                    DefileSpriteGauche(755, 1661, 453, 94, 151, gameTime);
                }
                if (!KState.IsKeyDown(Keys.D) && !(KState.IsKeyDown(Keys.Q)))
                { pirouette = false; }

            }

            //Permet de retomber


            if (t1 <= 0)

                saute = false;

        }
    }
    #endregion saut

}





